package TwoSumIIInputarrayissorted;

public class Solution {
    public int[] twoSum(int[] numbers, int target) {
    	int n=numbers.length;
        int left=0,right=n-1;
        while (left+1<=right){
        	int mid=numbers[left]+numbers[right];
        	if (mid==target) {
        		int[] result={left+1,right+1};
        		return result;
        	}
        	if (mid<target) left++;
        	else right--;
        }
		int[] result={left,right};
		return result;
    }
    public static void main(String args[]) {
    	int[] result={3,24,50,79,88,150,345};
    	Solution so=new Solution();
    	System.out.println(so.twoSum(result, 200));
	}
}
